<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('* 商品ID')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-goods_sn" data-rule="required" class="form-control" onkeyup="search()" name="row[goods_sn]" type="text">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('游戏名称')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-gamename" class="form-control" readonly name="row[gamename]" type="text">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('游戏区服')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-plat_id" class="form-control" readonly name="row[plat_id]" type="text" value="">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('录入方式')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="radio">
                <label><input type="radio" name="row[type]" checked value="1" />卖家信息</label>

                <label><input type="radio" name="row[type]" value="2" />聊天记录</label>
            </div>
        </div>
    </div>
    <div class="form-group" data-type="menu">
        <label class="control-label col-xs-12 col-sm-2">{:__('卖家手机号')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-mobile" class="form-control" name="row[mobile]" type="text" value="">
        </div>
    </div>
    <div class="form-group" data-type="menu">
        <label class="control-label col-xs-12 col-sm-2">{:__('卖家QQ号')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-qq" class="form-control" name="row[qq]" type="text" value="">
        </div>
    </div>
    <div class="form-group" data-type="menu">
        <label class="control-label col-xs-12 col-sm-2">{:__('游戏账号')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-g_account" class="form-control" name="row[g_account]" type="text" value="">
        </div>
    </div>
    <div class="form-group" data-type="menu-image">
        <label class="control-label col-xs-12 col-sm-2">{:__('聊天截图')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-images" class="form-control" size="50" name="row[lt_image]" type="text">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-images"></span>
            </div>
            <ul class="row list-inline faupload-preview" id="p-images"></ul>
        </div>
    </div>

    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
<script>
    function search() {
        var order_sn = $("#c-goods_sn").val();
        var url = "extension/goods/search";
        $.ajax({
            type:'get',
            url:url,
            data:"order_sn="+order_sn,
            success:function(res){
                var result = JSON.parse(res);
                console.log(result.gamename)
                console.log(result.server)
                $("#c-gamename").val(result.gamename)
                $("#c-plat_id").val(result.server)
            }
        })
    }

</script>
